home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jazlib.arc / MEMB.ASM < prev    next >
Assembly Source File  |  1988-12-18  |  1KB  |  56 lines

  1. Comment *
  2. ┌────────────────────────────────────────────────────────────────────────────┐
  3. │memb.asm                                     │
  4. │Look at a byte of memory, pass it back to c as the function result.         │
  5. │                                         │
  6. │Synopsis:                                     │
  7. │  int seg = 0x40,ofs = 0x49,screenmode;                     │
  8. │                                         │
  9. │  screenmode = memb(seg,ofs);                             │
  10. └────────────────────────────────────────────────────────────────────────────┘
  11. *
  12.  
  13. ;=============================================================================
  14. ;                    Data
  15. ;=============================================================================
  16.  
  17. DGROUP    group    _DATA
  18. _DATA    segment word public 'DATA'
  19.     assume    ds:DGROUP
  20.  
  21.     ; Your Data goes here . . .
  22.  
  23. _DATA    ends
  24.  
  25. ;=============================================================================
  26. ;                   Code
  27. ;=============================================================================
  28.  
  29.     assume cs:_text
  30. _text    segment public byte 'code'
  31.     PUBLIC _memb
  32.  
  33. _memb        proc near
  34.  
  35.     push bp             ; save base of stack
  36.     mov bp,sp            ; establish stack frame
  37.  
  38.     push ds             ; save data and extra segs
  39.  
  40.     push [bp+4]            ; get segment address
  41.     pop ds
  42.     mov bx,[bp+6]            ; get offset address
  43.     mov bx,[bx]
  44.     mov al,bl            ; get byte in return parameter
  45.     xor ah,ah
  46.  
  47.     pop ds                ; restore data and extra segs
  48.  
  49.     mov sp,bp            ; restore stack pointer
  50.     pop  bp             ; and base of stack
  51.     ret                ; return to caller
  52.  
  53. _memb        endp
  54. _text    ends
  55. end
  56.